/**
 * 与打印业务有关的API
 */
import request from "../../utils/request";

/**
 * 根据文件ID删除文件
 * @param {String} fileId 
 * @returns Promise
 */
export function deleteFile(fileId) {
  return request({
    url: `/printer/deleteFile/${fileId}`,
    method: 'DELETE'
  })
}

/**
 * 提交订单
 * @param {Object} data {colorInfo: "black",direction: "row",paper: "A4",page: "single",shop: "001B",remark: "",fileUploadCompleted:[{id:'O001',name:'测试文件'}]}
 * @param {String} userId u001
 * @returns Promise
 */
export function submitOrder(data, userId) {
  return request({
    url: `/user/submitOrder/${userId}`,
    method: 'POST',
    data
  })
}

/**
 * 根据学校ID获取该学校下的打印店信息
 * @param {String} schoolId 
 * @returns Promise
 */
export function getShopList(schoolId){
  return request({
    url:`/user/getShopBySchoolId/${schoolId}`,
    method:'GET'
  })
}

export function uploadFileUrl(){
  return `http://127.0.0.1:7001/v1/file/uploadFile`
}